package com.yubest.springbootsecurity.service.impl;

import com.yubest.springbootsecurity.bean.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

import java.util.Collections;

@Service
public class UserDetailsServiceImpl implements UserDetailsService {
    
    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        User user = new User();
        user.setId(1L);
        user.setUsername(username);
        user.setPassword("123456");
        user.setPhone("18800000000");
        user.setRoleIds(Collections.singletonList(1L));
        return user;
    }
}
